<template>
  <div id="app">
    <div class="container">
      <!-- 侧边栏 -->
      <div class="sidebar">
        <div class="sidebar-header">
          <h2><i class="fas fa-graduation-cap"></i> 教学科研管理系统</h2>
        </div>
        <nav class="sidebar-nav">
          <ul>
            <li :class="{ active: currentTab === 'student-management' }" @click="switchTab('student-management')">
              <i class="fas fa-users"></i> 学生管理
            </li>
            <li :class="{ active: currentTab === 'paper-management' }" @click="switchTab('paper-management')">
              <i class="fas fa-file-alt"></i> 论文管理
            </li>
            <li :class="{ active: currentTab === 'vertical-project' }" @click="switchTab('vertical-project')">
              <i class="fas fa-project-diagram"></i> 纵向课题
            </li>
            <li :class="{ active: currentTab === 'horizontal-project' }" @click="switchTab('horizontal-project')">
              <i class="fas fa-tasks"></i> 横向课题
            </li>
            <li :class="{ active: currentTab === 'statistics' }" @click="switchTab('statistics')">
              <i class="fas fa-chart-bar"></i> 统计分析
            </li>
          </ul>
        </nav>
      </div>

      <!-- 主内容区 -->
      <div class="main-content">
        <!-- 学生管理页面 -->
        <StudentView v-if="currentTab === 'student-management'" />
        
        <!-- 论文管理页面 -->
        <PaperView v-if="currentTab === 'paper-management'" />
        
        <!-- 纵向课题页面 -->
        <VerticalProjectView v-if="currentTab === 'vertical-project'" />
        
        <!-- 横向课题页面 -->
        <HorizontalProjectView v-if="currentTab === 'horizontal-project'" />
        
        <!-- 统计分析页面 -->
        <div v-if="currentTab === 'statistics'" class="statistics-page">
          <div class="content-header">
            <h1>统计分析</h1>
          </div>
          <div class="stats-container">
            <div class="stats-grid">
              <div class="stats-card">
                <div class="stats-icon">
                  <i class="fas fa-users"></i>
                </div>
                <div class="stats-content">
                  <h3>{{ stats.totalStudents }}</h3>
                  <p>学生总数</p>
                </div>
              </div>
              <div class="stats-card">
                <div class="stats-icon">
                  <i class="fas fa-file-alt"></i>
                </div>
                <div class="stats-content">
                  <h3>{{ stats.totalPapers }}</h3>
                  <p>论文总数</p>
                </div>
              </div>
              <div class="stats-card">
                <div class="stats-icon">
                  <i class="fas fa-project-diagram"></i>
                </div>
                <div class="stats-content">
                  <h3>{{ stats.totalVerticalProjects }}</h3>
                  <p>纵向课题</p>
                </div>
              </div>
              <div class="stats-card">
                <div class="stats-icon">
                  <i class="fas fa-tasks"></i>
                </div>
                <div class="stats-content">
                  <h3>{{ stats.totalHorizontalProjects }}</h3>
                  <p>横向课题</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import StudentView from './views/StudentView.vue'
import PaperView from './views/PaperView.vue'
import VerticalProjectView from './views/VerticalProjectView.vue'
import HorizontalProjectView from './views/HorizontalProjectView.vue'

export default {
  name: 'App',
  components: {
    StudentView,
    PaperView,
    VerticalProjectView,
    HorizontalProjectView
  },
  data() {
    return {
      currentTab: 'student-management',
      stats: {
        totalStudents: 0,
        totalPapers: 0,
        totalVerticalProjects: 0,
        totalHorizontalProjects: 0
      }
    }
  },
  methods: {
    switchTab(tab) {
      this.currentTab = tab;
    }
  }
}
</script>

<style>
#app {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100vh;
}

.container {
  display: flex;
  height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
  width: 250px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.sidebar-header i {
  margin-right: 10px;
  color: #ffd700;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
}

.sidebar-nav li {
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav li:hover {
  background-color: rgba(255,255,255,0.1);
  border-left-color: #ffd700;
}

.sidebar-nav li.active {
  background-color: rgba(255,255,255,0.2);
  border-left-color: #ffd700;
}

.sidebar-nav i {
  margin-right: 10px;
  width: 20px;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  margin-left: 250px;
  background-color: #f5f7fa;
  overflow-y: auto;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.content-header h1 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
}

/* 统计分析页面样式 */
.statistics-page {
  padding: 20px;
}

.stats-container {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.stats-card {
  display: flex;
  align-items: center;
  padding: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
  transition: transform 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-5px);
}

.stats-icon {
  font-size: 48px;
  margin-right: 20px;
  color: #ffd700;
}

.stats-content h3 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.stats-content p {
  font-size: 16px;
  margin: 0;
  opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  
  .main-content {
    margin-left: 200px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }
  
  .stats-card {
    padding: 20px;
  }
  
  .stats-icon {
    font-size: 36px;
    margin-right: 15px;
  }
  
  .stats-content h3 {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .container {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
</style>
